package com.example.enetity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import jakarta.validation.constraints.Email;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDateTime;
@Data
//需要无参构造，这对读取很重要
@NoArgsConstructor
//@NotBlank
public class User {
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;//主键ID
    @Length(min = 3,max = 16) //设置参数规则
    private String username;//用户名

//    忽略属性，使得信息返回没有它
//    @JsonIgnore
    @Length(min = 5,max = 16)
    private String password;//密码

//    @JsonIgnore
//    @TableField(exist = false)
//    private String rePassword;//密码
    @Length(min = 1,max = 20)
    private String nickname;//昵称
    @Email
    private String email;//邮箱
    private String userPic;//用户头像地址
    private LocalDateTime createTime;//创建时间
    private LocalDateTime updateTime;//更新时间



    public User(String username, String password, LocalDateTime createTime, LocalDateTime updateTime) {
        this.username = username;
        this.password = password;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }
}
